#pragma once
#include<iostream>

namespace ReIterator{

    template <class Iterator , class Ref, class Ptr>
    class reverse_iterator{

        typedef reverse_iterator<Iterator, Ref, Ptr> Self;
        Iterator _reit;
        public:
            reverse_iterator(const Iterator& it = Iterator()):_reit(it)
        { }
        Self& operator++()
        {
            return --_reit;
        }

        Self operator++(int)
        {
            return _reit--;
        }

        Self& operator--()
        {
            return ++_reit;
        }

        Self operator--(int)
        {
            return _reit++;
        }

        Ref operator*() 
        {
            Iterator tmp = _reit;
            return *(--tmp);
        }

        Ptr operator->() 
        {
            Iterator tmp = _reit;
            tmp--;
            return tmp.operator->();
        }

        bool operator==(const Self& it) const
        {
            return _reit == it._reit;
        }
        bool operator!=(const Self& it) const
        {
            return _reit != it._reit;
        }

    };
}